<?
require ("library/blocks/FileBlock.php");
import_request_variables('gpc','i_');
session_start();

if ($i_type == 'logout')
{
//	echo 'changing state';
//	$_SESSION['s_loggedin'] = "no";
//	session_write_close ();
	session_unset();
	session_destroy(); // destroy session.
	$loginstate=false;
}


if ($i_type == 'login')
{
	session_write_close ();
	$logged_in = CheckLogin($i_user,$i_passwd);
	$out = '';
	if($logged_in['id'] > 0)
	{

		$user = GetUserDataById($logged_in['id']);
		$s_email = $user[0]['email'];
		$s_name = $user[0]['name'];
		$s_surname = $user[0]['surname'];
		$s_handle = $user[0]['handle'];
		$s_id = $user[0]['id'];
		$s_loggedin = "yes";
		session_register('s_email');
		session_register('s_name');
		session_register('s_surname');
		session_register('s_handle');
		session_register('s_id');
		session_register('s_loggedin');
		$_SESSION['s_email'] = $s_email;
		$_SESSION['s_name'] = $s_name;
		$_SESSION['s_surname'] = $s_surname;
		$_SESSION['s_id'] = $s_id;
		$_SESSION['s_loggedin'] = "yes";
		$_SESSION['s_handle'] = $s_handle;

		session_start();
	}
}
?>
<html>
<? include("pack/parts/head.part.html"); ?>

<body>
<? 
	//echo $_SESSION['s_loggedin'];
?>
<div id="page">
<? include ("pack/parts/titleblock.inc.php"); ?>
<?
if ($_SESSION['s_loggedin'] == "yes")
//if(isset($_SESSION['s_name']))
{
?>
	<div id="right-column">
		<? echo GetBigFileBlock(-3,5,true) ?>
		<? echo TopSharersBlock(5) ?>
	</div>
<?
}
?>
</div>

<?
include('pack/parts/main.inc.php');
?>

<? include("pack/parts/foot.part.html"); ?>
</div>
</body>
